
let webpack = require('webpack')
let base = require('./base')
let { merge } = require('webpack-merge')
const CopyPlugin = require("copy-webpack-plugin");
let path = require('path')
module.exports = merge(base, {
  mode: 'production',
  // entry: './src/index.js',
  // output: {
  //   filename: 'index.[contenthash:8].js',
  //   path: path.resolve(__dirname, '../dist'),
  //   // assetModuleFilename: 'imgs/[name][ext]'// 对应的webpack5的资源模块的文件输出
  // },
  plugins: [

    new webpack.DefinePlugin({
      BASE: JSON.stringify("http://localhost:9999")
    }),
    new CopyPlugin({
      // 复制的一个插件 
      patterns: [
        {
          from: path.resolve(__dirname, '../data'),
          to: path.resolve(__dirname, '../dist')
        }
      ],
    }),
    // new ESLintPlugin()
  ],
  module: {
    rules: [
      // {
      //   test: /\.css$/,
      //   use: [miniCssExtractPlugin.loader, 'css-loader', 'postcss-loader']
      // }, {
      //   test: /\.less$/,
      //   use: [miniCssExtractPlugin.loader, 'css-loader', 'less-loader', 'postcss-loader']
      // },
      // // {
      // //   test:/\.(jpg|png|webp|gif)$/,
      // //   use:{
      // //     loader:'url-loader'
      // //   }
      // // }
      // {
      //   test: /\.(jpg|png|webp|gif)$/,
      //   type: 'asset/resource'
      // },
      // // {
      // //   test: /\.js$/,
      // //   loader: 'eslint-loader',
      // //   exclude: /node_modules/
      // // }
    ]
  }
}) 